
{include file="res/header" /}
<style>
	.pagination { display: inline-block; padding-left: 0; margin: 20px 0; border-radius: 4px; }
	.pagination li { display: inline; }
	.pagination li a,.pagination li span { position: relative; float: left; padding: 6px 12px; margin-left: -1px; line-height: 1.428571429; text-decoration: none; background-color: #fff; border: 1px solid #ddd; }
	.pagination li:first-child a { margin-left: 0; border-bottom-left-radius: 4px; border-top-left-radius: 4px; }
	.pagination li:last-child a { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
	.pagination li a:hover, .pagination li a:focus { background-color: #eee; }
	.pagination .active span, .pagination .active span:hover, .pagination .active span:focus { z-index: 2; color: #fff; cursor: default; background-color: #428bca; border-color: #428bca; }
	.pagination .disabled span, .pagination .disabled span:hover, .pagination .disabled span:focus { color: #999; cursor: not-allowed; background-color: #fff; border-color: #ddd; }
	.pagination-lg li a { padding: 10px 16px; font-size: 18px; }
	.pagination-sm li a, .pagination-sm li span { padding: 5px 10px; font-size: 12px; }
</style>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 数据库 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<tr colspan="2"><button class="btn btn-primary " id="beifen">备份</button></tr>
	<table class="table table-border table-bordered table-bg">


			<thead>

			<tr>

				<th>时间</th>
				<th>操作</th>
			</tr>
			</thead>

			<tbody>

			{volist name="dblist" id="row"}
				<tr>
				<td>{:date('Y-m-d H:i:s',$row.time)}</td>
				<td>
					<a class="btn btn-xs btn-outline btn-success ajax-a" onclick="goimport('{$row.time}')"> 导入</a>
					<a class="btn btn-xs btn-outline btn-danger ajax-a" onclick="delFile('{$row.time}')">删除</a>
					<a class="btn btn-xs btn-outline btn ajax-a"  href="downloadFile?time={$row.time}" title="下载保存SQL数据库备份文件">下载文件</a>

				</td>
			</tr>
			{/volist}
			</tbody>

		</table>
			</div>

</body>
{include file="res/footer" /}
<script type="text/javascript" src="__VIEW/res/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__VIEW/res/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__VIEW/res/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
	//删除备份
	function delFile(time){
		layer.confirm('确认要删除吗？',function(index){
			$.ajax({
				type: 'get',
				url: 'delFile',
				data:{time:time},
				dataType: 'json',
				success: function(data){

					window.location.reload()
				},
				error:function(data) {
					layer.msg('删除失败!',{icon:2,time:1000});
				},
			});
		});


	}
	//下载备份
	function downloadFile(time){
		$.get('downloadFile',{'time':time},function(){

		});
	}
	//还原备份

	function goimport(time){
		layer.confirm('确认要还原吗？',function(index) {
			$.ajax({
				type: 'get',
				url: 'import',
				data: {time: time},
				dataType: 'json',
				success: function (data) {

					layer.msg('操作成功!', {icon: 1, time: 1000});
				},
				error: function (data) {
					layer.msg('删除失败!', {icon: 2, time: 1000});
				},
			});
		});




	}
	$(function(){
		$('#beifen').click(function(){
			$.get('backup',function(){
				window.location.reload()
			});
		});

	});

</script>
</html>